import { Faction } from "../types/Faction";
import { Hero } from "../types/Hero";
import { skillsTable } from "./skills-table";
import { skinsTable } from "./skins-table";

export type HerosTableRegisterParams = { heroId: number; name: string; tetrarch: boolean; factions: Faction[]; health: number; healthLimit: number; skinIds: number[]; skillIds: number[]; description: string };
export const herosTable = {
	heros: [] as Hero[],
	register(params: HerosTableRegisterParams) {
		const hero = {
			heroId: params.heroId,
			name: params.name,
			factions: params.factions,
			health: params.health,
			healthLimit: params.healthLimit,
			skins: skinsTable.skins.filter((v) => params.skinIds.includes(v.skinId)),
			skills: skillsTable.skills.filter((v) => params.skillIds.includes(v.skillId)),
			description: params.description,
			tetrarch: params.tetrarch,
		};
		this.heros.push(hero);
	},
};
